import Vue from 'vue'
import Router from 'vue-router'

//登陆
import Login from '../components/Public/login'

//公共
import Welcome from '../components/Public/Welcome';
import Index from '../components/Public/Index';
import Communication from '../components/Public/Communication';

//超管
import AdministratorHome from '../components/Administrator/AdministratorHome';
import Customer from '../components/Administrator/Customer';
import GoodsToAdministrator from '../components/Administrator/GoodsToAdministrator';
import ShopOwner from '../components/Administrator/ShopOwner';
import ShopToAdministrator from '../components/Administrator/ShopToAdministrator';
import WarehouseToAdministrator from '../components/Administrator/WarehouseToAdministrator';

//顾客
import CustomerHome from "../components/Customer/CustomerHome";
import GoodsToCustomer from "../components/Customer/GoodsToCustomer";
import LogisticsToCustomer from "../components/Customer/LogisticsToCustomer";
import OrderToCustomer from "../components/Customer/OrderToCustomer";
import ShopToCustomer from "../components/Customer/ShopToCustomer";

//店主
import ShopOwnerHome from "../components/ShopOwner/ShopOwnerHome";
import GoodsToOwner from "../components/ShopOwner/GoodsToOwner";
import LogisticsToOwner from "../components/ShopOwner/LogisticsToOwner";
import ShopToOwner from "../components/ShopOwner/ShopToOwner";
import WarehouseToOwner from "../components/ShopOwner/WarehouseToOwner";

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index
    },
    {
      path: '/login',
      name: 'login',
      component: Login,
      meta:{ requireAuth: true}
    },
    {
      path: '/AdministratorHome',
      name: 'AdministratorHome',
      component: AdministratorHome,
      meta:{ requireAuth: true},
      children:
        [
          {
            path: '/',
            name: 'Welcome',
            component: Welcome,
            meta:{requireAuth: true}
          },
          {
            path: '/Customer',
            name: 'Customer',
            component: Customer,
            meta:{requireAuth: true}
          },
          {
            path: '/GoodsToAdministrator',
            name: 'GoodsToAdministrator',
            component: GoodsToAdministrator,
            meta:{requireAuth: true}
          }, {
            path: '/ShopOwner',
            name: 'ShopOwner',
            component: ShopOwner,
            meta:{requireAuth: true}
          },
          {
            path: '/ShopToAdministrator',
            name: 'ShopToAdministrator',
            component: ShopToAdministrator,
            meta:{requireAuth: true}
          },
          {
            path: '/WarehouseToAdministrator',
            name: 'WarehouseToAdministrator',
            component: WarehouseToAdministrator,
            meta:{requireAuth: true}
          }
        ]
    },
    {
      path: '/CustomerHome',
      name: 'CustomerHome',
      component: CustomerHome,
      meta:{ requireAuth: true},
      children:
        [
          {
            path: '/',
            name: 'Welcome',
            component: Welcome,
            meta:{requireAuth: true}
          },
          {
            path: '/ShopToCustomer',
            name: 'ShopToCustomer',
            component: ShopToCustomer,
            meta:{requireAuth: true}
          },
          {
            path: '/Communication',
            name: 'Communication',
            component: Communication,
            meta:{requireAuth: true}
          },
          {
            path: '/OrderToCustomer',
            name: 'OrderToCustomer',
            component: OrderToCustomer,
            meta:{requireAuth: true}
          },
          {
            path: '/GoodsToCustomer',
            name: 'GoodsToCustomer',
            component: GoodsToCustomer,
            meta:{requireAuth: true}
          },
          {
            path: '/LogisticsToCustomer',
            name: 'LogisticsToCustomer',
            component: LogisticsToCustomer,
            meta:{requireAuth: true}
          }
        ]
    },
    {
      path: '/ShopOwnerHome',
      name: 'ShopOwnerHome',
      component: ShopOwnerHome,
      meta:{ requireAuth: true},
      children:
        [
          {
            path: '/',
            name: 'Welcome',
            component: Welcome,
            meta:{requireAuth: true}
          },
          {
            path: '/ShopToOwner',
            name: 'ShopToOwner',
            component: ShopToOwner,
            meta:{requireAuth: true}
          },
          {
            path: '/WarehouseToOwner',
            name: 'WarehouseToOwner',
            component: WarehouseToOwner,
            meta:{requireAuth: true}
          },
          {
            path: '/GoodsToOwner',
            name: 'GoodsToOwner',
            component: GoodsToOwner,
            meta:{requireAuth: true}
          },
          {
            path: '/LogisticsToOwner',
            name: 'LogisticsToOwner',
            component: LogisticsToOwner,
            meta:{requireAuth: true}
          },
          {
            path: '/OrderToOwner',
            name: 'OrderToOwner',
            component: OrderToOwner,
            meta:{requireAuth: true}
          },
          {
            path: '/Communication',
            name: 'Communication',
            component: Communication,
            meta:{requireAuth: true}
          }
        ]
    }
  ]
})
